function T = transformation_mdh(alpha, a, d, theta, sigma, q)
if sigma
    theta = theta + q;
else
    d = d + q;
end

T = [cosd(theta * 180 / pi), -sind(theta * 180 / pi), 0, a;
    sind(theta * 180 / pi) * cosd(alpha * 180 / pi), cosd(theta * 180 / pi) * cosd(alpha * 180 / pi), -sind(alpha * 180 / pi), - d * sind(alpha * 180 / pi);
    sind(theta * 180 / pi) * sind(alpha * 180 / pi), cosd(theta * 180 / pi) * sind(alpha * 180 / pi), cosd(alpha * 180 / pi), d * cosd(alpha * 180 / pi);
    0, 0, 0, 1];